import Vue from 'vue'
import VueRouter from 'vue-router'
import {
	constantRoutes
} from '@/router/routerInfo.js'

Vue.use(VueRouter)

const router = new VueRouter({
	/**
	 * 设置上个路由打开时候滚到的位置 y：0
	 */
	scrollBehavior: () => ({
		y: 0
	}),
	/**
	 * 绑定路由信息
	 */
	routes: constantRoutes
})

/**
 * 重置路由信息
 */
export function resetRouter() {
	const newRouter = router
	router.matcher = newRouter.matcher
}
export default router
